RunUO Emulator
|
C# script vehicle system by Alambik |
You have first to graphicaly design your vehicle that you will use. As
an example, I delivered the "OctoNuker" lunar vehicle. But it can be
anything else: a carriage, an helicopter, a boat, a air ship... It's
always the same: you have to make 8 graphics: one for each directons. The 8
directions are: North, Right, East, Bottom, South, Left, West, Up.
Those graphics are in BMP format. For example, you can use 3D model if
you know 3DS Max.
- Pay attention to the angle view. Use the "pure white" color as a
background for transparency.
- Pay attention that the size of the bitmap "should" be the same and
that the 8 views are always well centered
- Pay attention to the fact of the hidden part of the diagonals in the bottom,
especially if the vehicle is big, so, leave some space in the bottom (about 1
tile).

Now, time to use MulPatcher:
- Open it
- Go in "Settings", load the "tiledatas" and
"Art" ressource files.
- Go in Art (S), and find 8 consecutive empty slots (they are in red in
the list), and note the slots numbers
- For each slots, right-click and choose "Load from Bitmap",
and select the corresponding graphical design. The order of the design slots MUST
be this one: North,Right,East,Bottom,South,Left,West,Up
- Go in Tiledata (S), and find the previews slots
- For each slots, give a "Name" and check "No Diagonal"
- Go in "Settings", save the "tiledatas" and "Art"
ressource files.

Now we need to create a new script
for the vehicle. An example is given for the OctoNuker, taken from a 3D free
model found at http://www.3dmodelworks.com
- The new vehicle class must derivate from Vehicule base class.
- The constructor take as an argument the first slot number (North direction)
- You can alter the several datas in the constructor:
MaxFuel : Maximum fuel a vehicle can contain. Each time the vehicle
move, it use 1 fuel. Put 0 for infinite fuel.
Fuel: Fuel that the vehicle actually contains.
CanFly: For vehicles that fly.
FlyAltitude: For vehicles that fly, the flying altitude.
MaxSlope: For earth vehicles the vertical maximum offset the vehicle can
climb.
WaterAllowed: Allow vehicle to move over water.
EarthAllowed: Allow vehicle to move over the earth.
StarsAllowed: Allow vehicle to move over the stars.
MaxSpeed: Maximum speed of the vehicle. “1” is the slowest speed.
NorthOffset: Distance in diagonal tiles from the real location of the vehicle
and the graphical view location.
StartSound: sound index of the start engine sound ( 0 for none )
StopSound: sound index of the stop engine sound ( 0 for none )
EngineSound: sound index of the running engine sound ( 0 for none )
MaxResistance: How many hit this vehicle can accept when going into
obstacles before being broken.
Size: The size of the vehicle: “0” for 1 tile, “1” for 3x3 tiles, “2”
for 5x5 tiles, and so on…
AlternativeItemID: (0 for none) you can use another 8 slots to define an
animation ( 2nd frame) when vehicle is moving.
- The new vehicle class can override those function to act when the player use
on of the 4 special buttons:
F1
F2
F3
F4
Aaah... now time to test your new
vehicle!
Add your vehicle using the [add command.
The vehicle is lockable if you want to use keys.
Double-click on the vehicle to enter it: a gump appears and you can not move.
There are 4 big arrows: Turn LEFT, Turn RIGHT, FORWARD, BACKWARD.
The big red button is the STOP button.
If you set CanFly, there are to small blue arrows: UP and DOWN.
The 4 small red button on the top left corners are the F1 to F4 special
functions activators.
The bottom of the gump is the fuel gauge.
You can leave the vehicule while it is stopped by double-clicking on it

If you are trying to create some
flying vehicles, you’ll find that you don’t really evaluate its altitude. You
can try to add a shadow on earth of your vehicle, using the [AddShadow
command: you will see the shadow of the same size of your vehicle on the earth!
(shadows are in beta testing, possible bug remained)
Have fun now!